var Action = require("../apiaction");
var Utility = require("../Utility/utility.js");
exports.adminuserAPI = function(router){

    //获取后台用户列表
    router.all('/adminUser/getadminuserlist',function(req,res){

        var params ={user_name: req.param("user_name")};
        params = Utility.get_list_page_size_param(req,params);




        Action.send(req, res,"/adminUser/getadminuserlist",params,function(res,data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //增加用户
    router.all('/adminUser/addadminuser',function(req,res){

        var params ={user_name: req.param("user_name"),role_id:req.param("role_id"),real_name: req.param("real_name"),};
        params = Utility.get_list_page_size_param(req,params);




        Action.send(req, res,"/adminUser/addadminuser",params,function(res,data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //删除用户
    router.all('/adminUser/deleteadminuser',function(req,res){

        var params ={user_id: req.param("user_id")};
        params = Utility.get_list_page_size_param(req,params);




        Action.send(req, res,"/adminUser/deleteadminuser",params,function(res,data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //删除用户
    router.all('/adminUser/deleteadminuser',function(req,res){

        var params ={user_id: req.param("user_id")};
        params = Utility.get_list_page_size_param(req,params);




        Action.send(req, res,"/adminUser/deleteadminuser",params,function(res,data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //修改用户
    router.all('/adminUser/changeuserinfo',function(req,res){

        var params ={user_id: req.param("user_id"),role_id: req.param("role_id"),real_name: req.param("real_name")};
        params = Utility.get_list_page_size_param(req,params);




        Action.send(req, res,"/adminUser/changeuserinfo",params,function(res,data) {
            res.status(200).json(JSON.parse(data));
        });
    });


    //修改用户
    router.all('/adminUser/resetpassword',function(req,res){

        var params ={user_id: req.param("user_id")};
        params = Utility.get_list_page_size_param(req,params);




        Action.send(req, res,"/adminUser/resetpassword",params,function(res,data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //修改密码
    router.all('/adminUser/changepassword',function(req,res){

        var params ={password: req.param("password"),oldpassword:req.param("oldpassword")};
        params = Utility.get_list_page_size_param(req,params);




        Action.send(req, res,"/adminUser/changepassword",params,function(res,data) {
            res.status(200).json(JSON.parse(data));
        });
    });

}
